<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('室温采集数据列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>室温采集器id：</label>
                                <input type="text" name="brtId" id="tempId" th:value="${brtId}"/>
                            </li>
                            <li>
                                <label>内部NTC故障报警：</label>
                                <select name="alarm1" th:with="type=${@dict.getType('alarm_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>外部NTC故障报警：</label>
                                <select name="alarm2" th:with="type=${@dict.getType('alarm_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>温湿度传感器故障报警：</label>
                                <select name="alarm3" th:with="type=${@dict.getType('alarm_level')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>查询时间： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]" th:value="${beginTime}"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]" th:value="${endTime}"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-warning" onclick="$.operate.exportExcel()" shiro:hasPermission="module:temp:record:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "module/temp/record";
        var datas = [[${@dict.getType('alarm_level')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                exportUrl: prefix + "/export",
                modalName: "室温采集数据",
                queryParams: queryParams,
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'tempId',
                    title: '室温采集器id'
                },
                {
                    field: 'temp',
                    title: '温度(℃)'
                },
                {
                    field: 'damp',
                    title: '湿度(%)'
                },
                {
                    field: 'elec',
                    title: '电量(V)'
                },
                {
                    field: 'alarm1',
                    title: '外部NTC故障报警',
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'alarm2',
                    title: '外部NTC故障报警',
                    formatter: function(value, item, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                {
                    field: 'alarm3',
                    title: '温湿度传感器故障报警',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                    {
                        field: 'createTime',
                        title: '采集时间'
                    }

                ]
            };
            $.table.init(options);
        });

        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.tempId = $("#tempId").val();
            return search;
        }
    </script>
</body>
</html>